feat: expose OIDC end-session endpoint - #1102
Draft
norrs wants to merge 15 commits into
Draft
Conversation
OAuth-backed sessions currently only log out of Tinyauth. When the upstream provider keeps its SSO session, the next protected application access can immediately create a new Tinyauth session, so logout does not behave like an end-to-end sign-out for OIDC providers that support RP-initiated logout. Add an optional OAuth provider logoutUrl for the OpenID Provider end_session_endpoint and keep the provider id_token server-side on the Tinyauth session. The logout handler now deletes the local session, builds the OP logout request with client_id, id_token_hint, post_logout_redirect_uri, and state, and returns that redirect to the frontend. The callback endpoint validates and restores the requested application return URL after the OP hop. Persist oauth_id_token for SQLite, Postgres, memory, SQLC generated repositories, and store wrapper models so refreshed sessions retain the token. Add migrations for both database drivers. Update the logout page and quick actions menu to follow backend-provided redirect URLs while keeping Tinyauth redirect_uri separate from OIDC post_logout_redirect_uri. Cover the new behavior with controller tests for safe logout redirects, logout URL construction, and use of the server-side id_token. Enable TLS on the dev whoami route so the local Traefik setup exercises the secure-cookie and OIDC logout flow. Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Spec: OpenID Connect RP-Initiated Logout 1.0 end_session_endpoint MUST use https. Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment) Refs: tinyauthapp#1094 (comment) Co-Authored-By: OpenAI Codex <codex@openai.com>
Advertise RP-initiated logout in discovery, validate downstream ID token hints and registered post-logout redirects, and reuse the upstream logout cascade with one-time callback tickets. Co-Authored-By: OpenAI Codex <codex@openai.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
This PR depends on #1094 and must merge after it. Because the branches are on a fork, GitHub requires this PR to target
main; its Files view will include the parent until #1094 merges. Review the endpoint-only change here:norrs/tinyauth@feat/sso-logout...feat/oidc-end-session
Summary
end_session_endpointin OIDC discoveryVerification
make testmake vetgo test -count=1 ./internal/controller ./internal/service